import Vue from 'vue'
import App from './App.vue'

//三级联动组件(全局组件)
import TypeNav from '@/components/TypeNav'
//轮播图组件
import Carsousel from "@/components/Carsousel";
//分页器组件
import Pagination from '@/components/Pagination'
Vue.component(TypeNav.name,TypeNav)
Vue.component(Carsousel.name, Carsousel);
Vue.component(Pagination.name, Pagination);

//按需引入element-ui
import { Button,MessageBox } from 'element-ui'
Vue.component(Button.name, Button);
//ElementUI注册组件的时候，还有一种写法，挂在原型上
Vue.prototype.$msgbox = MessageBox;
Vue.prototype.$alert = MessageBox.alert;

//  关闭vue的生产提示
Vue.config.productionTip = false

// 引入VueRouter
import VueRouter from 'vue-router'
// 引入路由器
import router from './router/index.js' 
// 引入store
import store from './store/index'
// 引入MockServe
import '@/mock/mockServe.js'
// 引入swiper
import 'swiper/css/swiper.css'
// 应用插件
Vue.use(VueRouter) 

//引入图片懒加载插件
import VueLazyload from 'vue-lazyload';
import atm from '@/assets/1.gif';
//应用插件
Vue.use(VueLazyload,{
   //懒加载默认的图片
   loading:atm
});

//引入表单校验插件
import "@/plugins/validate";


//测试后端接口
// import { reqCategoryList } from './api'
// reqCategoryList();

//统一接入api请求文件夹中的所有接口
import * as API from '@/api'
//console.log(API);
new Vue({
  render: h => h(App),
  router,
  store,
   //全局事件总线$bus配置
   beforeCreate() {
     Vue.prototype.$bus = this;
     Vue.prototype.$API = API;
  },
}).$mount('#app')
